class BootStrap {

    AuthenticateService authenticateService
    
    def init = {servletContext ->
        def roleAdmin = new Role(authority:'ROLE_ADMIN',description:'Administrator').save()
        def roleUser = new Role(authority:'ROLE_USER',description:'User').save()
            
        def passwordHash = authenticateService.passwordEncoder('abc')
        
        def userAdmin = new UserDetails(username:"admin",displayName:"Administrator",passwordHash:passwordHash,
            enabled:true,description:"",email:"")

        def userUser = new UserDetails(username:"user",userRealName:"User",passwordHash:passwordHash,
            enabled:true,description:"",email:"")
        
        roleAdmin.addToPeople(userAdmin)
        roleUser.addToPeople(userUser)
    }
    def destroy = {
    }
} 